package com.tledu.studentmanager.controller;

import com.tledu.studentmanager.mqtt.MqttProviderConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/mqtt")
public class MQTTController {

    @Autowired
    MqttProviderConfig mqttProviderConfig;

    @RequestMapping("/send")
    @ResponseBody
    public String sendMsg(int qos,boolean retained,String topic,String message) {
        mqttProviderConfig.publish(qos, retained, topic, message);
        return "发送成功";
    }
}
